UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xh21jqdxu1vvXHhwUQoTVTKHo5kXj2mo73EPzkWqiUc=' 
WHERE 
  key_id = '85fee4b75a5679204c74c02a988914fbbb1aedb4653c7dc0bcbf77c0ac86a59a' 
  AND (
    token = 'Xh21jqdxu1vvXHhwUQoTVTKHo5kXj2mo73EPzkWqiUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026