UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cg9zxMU8NYqZYEh/QC700DBImGGl372bsxq6NkHxvc4=' 
WHERE 
  key_id = '71f29340e32739501639d43b52854f7183eab2a69498f9a87a943b223047ad2f' 
  AND (
    token = 'Cg9zxMU8NYqZYEh/QC700DBImGGl372bsxq6NkHxvc4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032