UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kCjxtuNlGU84DI26XA/+j4a3aAPMzmZU3pQ/+m+ULTM=' 
WHERE 
  key_id = '76528dddecbf52b0c776799b0314280a475e749bd4f46cabf344b7ec317378a2' 
  AND (
    token = 'kCjxtuNlGU84DI26XA/+j4a3aAPMzmZU3pQ/+m+ULTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036