UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PUIYxvgJl12mcuH9TkDU749oHDdNlEISHmewFulG9CM=' 
WHERE 
  key_id = '7fbd436c39d0fe11c987474cd05f3141f85790b766cd0f354a5655251ce7762c' 
  AND (
    token = 'PUIYxvgJl12mcuH9TkDU749oHDdNlEISHmewFulG9CM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015