UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uR1YT36wxi9jaiEpZi8Zr0R2HWRt0no56Iy7UTvlkBs=' 
WHERE 
  key_id = '2d9ac0b1c74cd9f13dca7925553dbd12eefba3b34ef380be7de15a9175e7217c' 
  AND (
    token = 'uR1YT36wxi9jaiEpZi8Zr0R2HWRt0no56Iy7UTvlkBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048