UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EYUoOKBa47VTZh4v2ipAqVrHdyrrGt0uoqV3/YAkJMM=' 
WHERE 
  key_id = '03e3957d1ec6230aa2ab13b63079ca4e340afe10c6d22f995f9d4fbdedaa557c' 
  AND (
    token = 'EYUoOKBa47VTZh4v2ipAqVrHdyrrGt0uoqV3/YAkJMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038