UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BwTSUJDVWHNE/Op7GgawoS9ScHX2XWaZKhfQdZ0k7z8=' 
WHERE 
  key_id = '4e91007698821129a5fa1c57c17bfe353c22e12993b00e7eadf3d65d90ee830b' 
  AND (
    token = 'BwTSUJDVWHNE/Op7GgawoS9ScHX2XWaZKhfQdZ0k7z8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038