UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rQdiJ6ib/H0HiTDuExrX1d5R7ekpvKJ0++9Vyz9Ti+0=' 
WHERE 
  key_id = 'a22bb984036fce936dbc80f15fd869aa7f316997e0b7bc28e10f54f03c6a4d82' 
  AND (
    token = 'rQdiJ6ib/H0HiTDuExrX1d5R7ekpvKJ0++9Vyz9Ti+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046