UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VBTB516ASMBtR05Erl5451epQbqHKBsxKtK2PyCRSNE=' 
WHERE 
  key_id = '0d58ac2a92f77e7b5ee709a4e305c95f617ee506aef37512e98460245122ec88' 
  AND (
    token = 'VBTB516ASMBtR05Erl5451epQbqHKBsxKtK2PyCRSNE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051