UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IsqSfeVtR01g0pTX7H9ZDjOUVZd5u4Wavs+y/zr+Wo8=' 
WHERE 
  key_id = '649ca352083fd526004c6bcc909bbebd59675a8e47ff6d8db433cb0f615b5821' 
  AND (
    token = 'IsqSfeVtR01g0pTX7H9ZDjOUVZd5u4Wavs+y/zr+Wo8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024